import request from '@/utils/request'

export function listCategory() {
  return request({
    method: 'get',
    url: 'category/list'
  })
}

export function listCourse(params) {
  return request({
    method: 'get',
    url: 'course/list',
    params: params
  })
}

export function listCourseByOrder(params) {
  return request({
    method: 'get',
    url: 'order/courses',
    params: params
  })
}

export function listCourseCategory() {
  return request({
    method: 'get',
    url: 'category/list'
  })
}

export function switchStatus(params) {
  return request({
    method: 'get',
    url: 'course/switchStatus',
    params: params
  })
}

export function addCourse(data) {
  return request({
    method: 'post',
    url: 'course/add',
    data: data
  })
}

export function updateCourse(data) {
  return request({
    method: 'post',
    url: 'course/update',
    data: data
  })
}

export function listAllCourse() {
  return request({
    method: 'get',
    url: 'course/listAll'
  }, true)
}

export function bookCourseAudit(data) {
  return request({
    method: 'post',
    url: 'audit/book',
    data: data
  }, true)
}

export function getCourseDetail(params) {
  return request({
    method: 'get',
    url: 'course/detail',
    params: params
  })
}

export function addCourseDetail(data) {
  return request({
    method: 'post',
    url: 'course/detail',
    data: data
  }, true)
}
